package com.fr.report.script.function;

import com.fr.report.script.Function;
import com.fr.report.script.Function.Type;
import com.fr.report.script.NormalFunction;
import com.fr.report.script.Primitive;
import com.fr.report.script.core.FunctionHelper;

public class ASINH extends NormalFunction
{
  public Object run(Object[] paramArrayOfObject)
  {
    if (paramArrayOfObject.length < 1)
      return Primitive.ERROR_NAME;
    double d1 = 0.0D;
    for (int i = 0; i < paramArrayOfObject.length; ++i)
      if (paramArrayOfObject[i] instanceof Number)
      {
        double d2 = ((Number)paramArrayOfObject[i]).doubleValue();
        d1 = Math.log(d2 + Math.sqrt(d2 * d2 + 1.0D));
        break;
      }
    return FunctionHelper.parsePrimitiveDouble(d1);
  }

  public Function.Type getType()
  {
    return Function.MATH;
  }

  public String getCN()
  {
    return "ASINH(number): 返回指定数值的反双曲正弦值。反双曲正弦值的双曲正弦等于指定数值。即: ASINH(SINH(number))=number。\nNumber:任意实数。\n示例:\nASINH(-5)等于-2.312438341。\nASINH(8)等于2.776472281。\nASINH(16)等于3.466711038。";
  }

  public String getEN()
  {
    return "ASINH(number): Returns the inverse hyperbolic sine of a number. The inverse hyperbolic sine is the value whose hyperbolic sine is number, so ASINH(SINH(number)) equals number.\nNumber is any real number.\n\nExample:\n   ASINH(-5)=-2.312438341\n   ASINH(8)=2.776472281\n   ASINH(16)=3.466711038";
  }
}